import React, { Component } from 'react'

import { PickerView } from 'antd-mobile'

import FilterFooter from '../FilterFooter'
import styles from './index.module.css'

export default class FilterPicker extends Component {
  state = {
    value: this.props.value
  }


  render() {
    return (
      <div className={styles.test}>
        {/* 选择器组件： */}
        <PickerView 
          data={this.props.data} 
          cascade={true} 
          value={this.state.value}
          cols={this.props.cols}
          onChange={ (val)=>{
            console.log(val)
            this.setState({value: val})
          } }
        />

        {/* 底部按钮 */}
        <FilterFooter onCancel={() => this.props.onCancel(this.props.type, this.state.value)} onOk={()=>this.props.onOk(this.props.type, this.state.value)}/>
      </div>
    )
  }
}
